<template>
  <div>
    <TitleBack :title-name="value"/>
    <div class="top">
      <img src="../../../public/images/头条.jpg">
      <span>账号登录</span>
    </div>
    <van-field v-model="text" label="用户名" placeholder="请输入用户名/手机号" class="input marginTOP"/>
    <van-field v-model="password" type="password" label="密码" placeholder="请输入密码" class="input"/>
    <van-checkbox v-model="checked" class="remember">记住我</van-checkbox>
    <!--    <button type="submit" @click="click">提交</button>-->
    <div style="margin: 16px;">
      <van-button round block type="danger" native-type="submit" @click="click">
        登 录
      </van-button>
    </div>

    <router-link to="/Registered" class="login">注册账号</router-link>
    <router-link to="/ForgotPassword" class="forget">忘记密码</router-link>

  </div>

</template>

<script>

import {getLogin} from "@/api/login-aip";
import TitleBack from "@/components/TitleBack";

export default {
  name: "MyLogin",
  components: {TitleBack},
  data() {
    return {
      value: "登录",
      text: "",
      password: "",
      checked: true,
    };
  },
  created() {

  },
  methods: {
    click() {
      console.log(this.text)
      console.log(this.password)

      getLogin(this.text, this.password).then((res) => {
        console.log(res)
        if (res.msg === "操作成功") {
          this.$router.push("/MyPage")
        }
      })
    }

  }

}
</script>

<style scoped lang="less">
.top {

  img {
    width: 50px;
    height: 30px;
    margin-left: 10px;
    vertical-align: middle;
  }

  font-size: 20px;
  margin: 30px 0;

}

.input {
  font-size: 18px;
  margin: 10px 0;
}

.marginTOP {
  //margin-top: 100px;
}

.remember {
  margin-left: 20px;
}

.login {
  float: left;
  margin-left: 20px;
}

.forget {
  float: right;
  margin-right: 20px;
}

a{
  color: #1989fa;
}

</style>